using System.Collections.Generic;
using com.tc.util;
using  com.tc.zigbee.zcl;
using  com.tc.zigbee.entity;
using  com.tc.zigbee.mt.income;
namespace com.tc.zigbee.mt
{
    public class IncomeMessageParser
    {
        //Length = 0x06-0x53  Cmd0 = 0x45  Cmd1 = 0x85  SrcAddr  Status  NwkAddr  ActiveEPCount 
        static public IncomeMessage parse(MtCommand c)
        {
            if (c.cmd0 == (byte)0x45 && c.cmd1 == (byte)0x81)
                return new IeeeResponse(c.command);
            if (c.cmd0 == (byte)0x45 && c.cmd1 == (byte)0x85)
                return new ActiveEndpointResponse(c.command);
            if (c.cmd0 == (byte)0x45 && c.cmd1 == (byte)0x84)
                return new SimpleDescriptorResponse(c.command);
            if (c.cmd0 == (byte)0x45 && c.cmd1 == (byte)0x82)
                return new NodeDescriptorResponse(c.command);
            if (c.cmd0 == (byte)0x45 && c.cmd1 == (byte)0x83)
                return new PowerDescriptorResponse(c.command);
            if (c.cmd0 == (byte)0x45 && c.cmd1 == (byte)0x87)
                return new ComplexDescriptorResponse(c.command);
            if (c.cmd0 == (byte)0x44 && c.cmd1 == (byte)0x81)
                return new AfIncomeMessage(c.command);
            if (c.cmd0 == (byte)0x44 && c.cmd1 == (byte)0x80)
                return new AfDataConfirm(c.command);
            if (c.cmd0 == (byte)0x64 && c.cmd1 == (byte)0x01)
                return new AfDataRequestResp(c.command);
            if (c.cmd0 == (byte)0x45 && c.cmd1 == (byte)0xc1)
                return new DeviceAnnounceIndication(c.command);
            return null;
        }
    }
}